package com.qfmy.controller.assistant;

import com.qfmy.service.assistant.ImageService;
import common.result.Result;
import jakarta.annotation.Resource;
import model.entity.assistant.Image;
import model.query.ImageQuery;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 清风明月
 * @Package com.qfmy.controller.assistant
 * @date 2025/5/19
 * @description 图片生成
 */
@RestController
@SuppressWarnings("all")
@RequestMapping("/app/image")
public class ImageController {

    /**
     * 注入service
     */
    @Resource
    private ImageService imageService;

    /**
     * 图片生成
     */
    @PostMapping("/img")
    public Result<List<String>> img(@RequestBody ImageQuery query) {
        List<String> list = imageService.img(query);
        return Result.ok(list);
    }

    /**
     * 获取生成的图片
     */
    @GetMapping("/getImg")
    public Result<List<Image>> getImg() {
        List<Image> list = imageService.getImg();
        return Result.ok(list);
    }

    /**
     * 根据类型分页获取图片
     */
    @PostMapping("/getImgByType")
    public Result<List<Image>> getImgByType(@RequestBody ImageQuery query) {
        List<Image> list = imageService.getImgByType(query);
        return Result.ok(list);
    }

    /**
     * 图片去水印
     */
    @PostMapping("/removeWatermark")
    public Result<String> removeWatermark(@RequestParam String url) {
       String  img = imageService.removeWatermark(url);
       return Result.ok(img);
    }

}
